package com.xiaoyuzhou.utils;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;

public class SPUtils {
	public static String readData (Context context, String name, String key) {
		SharedPreferences sp = context.getSharedPreferences(name, Context.MODE_PRIVATE);
		String ret = sp.getString(key, "");
		return ret;
	}
	
	/**
	 * 使用SharedPreferences保存数据
	 * Description:
	 * @param name xml名，一般为日期
	 * @param key
	 * @param value
	 *<br/> ModifiedLog:
	 *<br/> Log ID: 1.0 (Log编号 依次递增)
	 * <br/>Modified By: liubin Email:liubin@d-heaven.com at 2012-11-2 下午12:13:25
	 */
	public static void saveData(Context context, String name, String key, String value) {
		SharedPreferences sp = context.getSharedPreferences(name,
				Context.MODE_PRIVATE);
		Editor editor = sp.edit();
		editor.putString(key, value);
		editor.commit();
	}
}
